﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="BanHangOnline.aspx.cs" Inherits="Administrator_BanHangOnline" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Quản lý bán hàng online"></asp:Label>
    <br />
    <br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" EnableModelValidation="True" Width="100%" 
        CellPadding="4" ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" >
            <ItemStyle Width="20px" />
            </asp:CommandField>
            <asp:BoundField DataField="NicName" HeaderText="NickName" 
                SortExpression="NicName" />
            <asp:BoundField DataField="DienThoai" HeaderText="Điện thoại" 
                SortExpression="DienThoai" />
            <asp:BoundField DataField="Ten" HeaderText="Họ và tên" SortExpression="Ten" />
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
        DeleteCommand="DELETE FROM [HoTro] WHERE [ID] = @ID" 
        InsertCommand="INSERT INTO [HoTro] ([NicName], [DienThoai], [Ten]) VALUES (@NicName, @DienThoai, @Ten)" 
        SelectCommand="SELECT * FROM [HoTro]" 
        UpdateCommand="UPDATE [HoTro] SET [NicName] = @NicName, [DienThoai] = @DienThoai, [Ten] = @Ten WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="NicName" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Ten" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="NicName" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Ten" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="ID" 
        DataSourceID="SqlDataSource1" EnableModelValidation="True">
        <EditItemTemplate>
            ID:
            <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
            <br />
            NicName:
            <asp:TextBox ID="NicNameTextBox" runat="server" Text='<%# Bind("NicName") %>' />
            <br />
            DienThoai:
            <asp:TextBox ID="DienThoaiTextBox" runat="server" 
                Text='<%# Bind("DienThoai") %>' />
            <br />
            Ten:
            <asp:TextBox ID="TenTextBox" runat="server" Text='<%# Bind("Ten") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <EmptyDataTemplate>
            Hiện tại không có dữ liệu (Click Tạo mới)<br />
            <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click1">Tạo mới</asp:LinkButton>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            &nbsp;<table width="100%">
                <tr>
                    <td>
                        NicName:</td>
                    <td>
                        <asp:TextBox ID="NicNameTextBox0" runat="server" 
                            Text='<%# Bind("NicName") %>' />
                    </td>
                    <td>
                        DienThoai:</td>
                    <td>
                        <asp:TextBox ID="DienThoaiTextBox0" runat="server" 
                            Text='<%# Bind("DienThoai") %>' />
                    </td>
                    <td>
                        Ten:
                    </td>
                    <td>
                        <asp:TextBox ID="TenTextBox0" runat="server" Text='<%# Bind("Ten") %>' />
                        <br />
                    </td>
                    <td>
                        &nbsp;</td>
                </tr>
            </table>
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" />
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="NicNameTextBox0" Display="None" 
                ErrorMessage="Nick Name không được rỗng"></asp:RequiredFieldValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="TenTextBox0" Display="None" 
                ErrorMessage="Tên không được rỗng"></asp:RequiredFieldValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                ControlToValidate="DienThoaiTextBox0" Display="None" 
                ErrorMessage="Điện thoại không được rỗng"></asp:RequiredFieldValidator>
            <br />
            &nbsp;<br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" 
                onclick="InsertCancelButton_Click" />
        </InsertItemTemplate>
        <ItemTemplate>
            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Tạo mới" />
        </ItemTemplate>
    </asp:FormView>
    <br />
    </asp:Content>

